Skip to content

Convert yaml.ts to handle multiple models per method#2904

Merged
koesie10 merged 1 commit intomainfrom
koesie10/convert-yaml-modeled-methods
Oct 4, 2023
Merged

Convert yaml.ts to handle multiple models per method#2904
koesie10 merged 1 commit intomainfrom
koesie10/convert-yaml-modeled-methods

Conversation

@koesie10
Copy link
Copy Markdown
Member

@koesie10 koesie10 commented Oct 4, 2023

This changes YAML parsing/creating functions for the model editor to handle multiple models per method. The changes in the actual YAML handling are fairly small because the format itself already supports multiple models per method.

I've introduced a few helper functions to convert between the old and new types. This should only be necessary while we're in the middle of the transition to the new types and can be removed later. For now, we'll just take the first model in the array when converting from the new to the old type. This is a change in the behavior since currently we always take the last model in the array but this behavior is undocumented and unsupported, so it should be fine to change it.

Checklist

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • Issues have been created for any UI or other user-facing changes made by this pull request.
  • [Maintainers only] If this pull request makes user-facing changes that require documentation changes, open a corresponding docs pull request in the github/codeql repo and add the ready-for-doc-review label there.

This changes YAML parsing/creating functions for the model editor to
handle multiple models per method. The changes in the actual YAML
handling are fairly small because the format itself already supports
multiple models per method.

I've introduced a few helper functions to convert between the old and
new types. This should only be necessary while we're in the middle of
the transition to the new types and can be removed later. For now,
we'll just take the first model in the array when converting from the
new to the old type. This is a change in the behavior since currently
we always take the last model in the array but this behavior is
undocumented and unsupported, so it should be fine to change it.
@koesie10 koesie10 marked this pull request as ready for review October 4, 2023 11:40
@koesie10 koesie10 requested a review from a team as a code owner October 4, 2023 11:40
Copy link
Copy Markdown
Contributor

@robertbrignull robertbrignull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

So the behaviour when creating YAML files is now that all modelings for a method are treated as a unit. So if a method already has modelings [A, B] but then we try to write the new modeling [C], it'll remove A and B and just write C, instead of writing [A, B, C]. I think that's correct and the tests do cover this.

@koesie10 koesie10 enabled auto-merge October 4, 2023 11:57
@koesie10 koesie10 merged commit a6c9707 into main Oct 4, 2023
@koesie10 koesie10 deleted the koesie10/convert-yaml-modeled-methods branch October 4, 2023 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants